Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Identifying the columns of a browse

Next, you need to know how to identify the columns in the Order browse. The browse is a single Progress object with its own handle, but the columns in the browse have handles as well. The browse acts as a container for those columns much as a frame does for the fields and other objects it contains.

To get the handle to the first column in a browse, you use its FIRST-COLUMN attribute. The chain of columns is linked by the NEXT-COLUMN attribute of each column.

This next block of code checks to see if the current object in the frame is a browse. If it is, then it moves the browse to the left by changing its COLUMN attribute, and widens it by six characters by setting the WIDTH-CHARS attribute. It then walks through the columns, checking each one’s data type. If a column is a date, it widens it by four characters. You use the same DO WHILE VALID-HANDLE block header as for the frame itself to walk through all the columns in the browse:

ELSE IF hObject:TYPE = "Browse" THEN 
    DO: 
        ASSIGN hObject:COLUMN = hObject:COLUMN - 3 
               hObject:WIDTH-CHARS = hObject:WIDTH-CHARS + 6. 
        hColumn = hObject:FIRST-COLUMN. 
        DO WHILE VALID-HANDLE(hColumn): 
            IF hColumn:DATA-TYPE = "DATE" THEN 
               hColumn:WIDTH-CHARS = hColumn:WIDTH-CHARS + 4. 
            hColumn = hColumn:NEXT-COLUMN. 
        END. 
    END. 

Finally, you need to remember to move on to the next object in the frame before ending the original DO block:

    hObject = hObject:NEXT-SIBLING. 
END. 
END PROCEDURE. 

If you forget this step, your procedure goes into an infinite loop when you run it, and you’ll need to press CTRL+BREAK to end it.

Figure 18–12 shows what you see when you run the window.

Figure 18–12: Updated sample window


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095